var companyId = sessionStorageUtils.getJson(storageKey.sessionStorageKey.companyId);
var schoolId = sessionStorageUtils.getJson(storageKey.sessionStorageKey.schoolId);
var schoolMap = sessionStorageUtils.getJson(storageKey.sessionStorageKey.schoolMap);

var app = new Vue({
    el: '#app',
    data: {
        info: {},
        conversation: [],
        permissions: ['']
    },
    filters: {
        formatDate(time) {
            // time = time * 1000;
            let date = new Date(time);
            return formatDateTime(date)
        }
    },
    //进入页面初始化方法
    created: function () {
        var that = this;
        var token = sessionStorageUtils.getJson(storageKey.sessionStorageKey.token);
        if (empty(token)) {
            layer.msg("<span style='color:red'>登录超时！请重新登录！</span>", {time: 1500, icon: 5});
            setTimeout(function () {
                window.location.href = _LOGIN_PAGE;
            }, 1200);

            return;
        }
        that.getInfo();
        that.getConversation();
    },
    methods: {
        //权限控制
        permission: function (index) {
            return (_PERMISSIONS.indexOf(this.permissions[index]) != -1);
        },
        // 得到预约信息
        getInfo: function () {
            var that = this;
            var url = _HOST + _API.user_orderInfo_getById+"?id="+aGET.id;
            Get(that, url)
                .then(function (response) {
                    // 响应成功回调
                    console.log(response);
                    if (response) {
                        that.info = response.data;
                    }
                });
        },
        // 得到会话列表
        getConversation: function () {
            var that = this;
            var url = _HOST + _API.user_message_selectCommentByRelationIdAndType+"?relationId="+aGET.id+"&type=3,5"+"&companyId="+companyId;
            Get(that, url)
                .then(function (response) {
                    // 响应成功回调
                    console.log(response);
                    if (response) {
                        that.conversation = response.result;
                    }
                });
        }
    },
});
